package com.woniuxy.caradmin.service.impl;

import com.woniuxy.caradmin.entity.pojo.Driver;
import com.woniuxy.caradmin.entity.vo.DriverVo;
import com.woniuxy.caradmin.mapper.DriverMapper;
import com.woniuxy.caradmin.service.DriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DriverServiceImpl implements DriverService{
    @Autowired
    private DriverMapper driverMapper;
    @Override
    public List<Driver> selectAllDriver() {
        return driverMapper.selectAllDriver();
    }

    @Override
    public Integer insertDriver(Driver driver) {
        return driverMapper.insertDriver(driver);
    }

    @Override
    public Integer delectDriver(Integer id) {
        return driverMapper.delectDriver(id);
    }

    @Override
    public Integer updateDriver(Driver driver) {
        return driverMapper.updateDriver(driver);
    }

    @Override
    public List<Driver> selectNameAndPho(DriverVo driverVo) {
        return driverMapper.selectNameAndPho(driverVo);
    }

    @Override
    public boolean delectAllPathDriver(Integer[] ids) {
        if (ids!=null&&ids.length>0){
            for(Integer id:ids){
                driverMapper.delectDriver(id);
            }
        }
        return true;
    }
}
